#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int cases;
	cin >> cases;
	for(int i = 0; i < cases; ++i){
		int a, b, c;
		cin >> a >> b >> c;
		int min;
		if((a <= b && a >= c)||( a <= c && a >= b ))	// a is middle
			min = a;
		if((b <= c && b >= a)||( b <= a && b >= c ))	// b is middle
			min = b;
		if((c <= b && c >= a)||( c <= a && c >= b ))	// c is middle
			min = c;
		cout << "Case " << i+1 << ": " << min << endl;
	}
}
